package com.android.djlmapp.adapter.home;

import android.content.Context;
import android.view.View;

import com.android.djlmapp.R;
import com.android.djlmapp.model.home.GongGaoInfo;

import org.refresh_view.pullrecyclerview.BaseRecyclerAdapter;
import org.refresh_view.pullrecyclerview.BaseViewHolder;

import java.util.ArrayList;

public class GongGaoListAdapter extends BaseRecyclerAdapter<GongGaoInfo.ListBean> {
    public GongGaoListAdapter(Context context) {
        super(context, R.layout.item_gonggao, new ArrayList<GongGaoInfo.ListBean>());
    }

    @Override
    protected void convert(BaseViewHolder holder, GongGaoInfo.ListBean item) {

        holder.setText(R.id.tv_gonggao, item.getTitle());
        holder.setText(R.id.tv_time, item.getTime());

        holder.setOnClickListener(R.id.ll_gonggao, new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                mOnItemClickListener.onItemClick(item);
            }
        });
    }


    public OnItemClickListener mOnItemClickListener;

    public interface OnItemClickListener {
        void onItemClick(GongGaoInfo.ListBean item);
    }

    public void setOnItemClickListener(OnItemClickListener mOnItemClickLitener) {
        this.mOnItemClickListener = mOnItemClickLitener;
    }
}
